#include <curses.h>
#include <iostream>
#include <signal.h>
#include <stdlib.h>
#include "game.h"

using std::cout;
using std::cerr;
using std::endl;

void finish(int sig) {
  endwin();
  exit(0);
}

void setup() {
  signal(SIGINT, finish);/* register the signal handler */
  initscr();             /* initialize the curses library */
  keypad(stdscr, TRUE);  /* enable keyboard mapping */
  nonl();                /* tell curses not to do NL->CR/NL on output */
  cbreak();              /* take input chars one at a time, no wait for \n */
  noecho();              /* echo input - in color */
}

int main(int argc, char** argv) {
  setup();

  Game g("map.cpp", stdscr);
  g.play();

  endwin();
  return 0;
}
